// custom-tab-bar/tabbar.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
 
  },
 
  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    color: "#f60",
    selectedColor: "#3cc51f",
    color: "#7A7E83",
    selectedColor: "#627c64",
    borderStyle: "black",
    backgroundColor: "#ffffff",
    list: [
      {
        pagePath: "/pages/learn/learn",
        text: "首页",
        iconPath: "/icon/learn/learnIcon.png",
        selectedIconPath: "/icon/learn/learnIconSelected.png"
      },
      {
        pagePath: "/pages/communicate/communicate",
        text: "交流",
        iconPath: "/icon/communicate/communicateIcon.png",
        selectedIconPath: "/icon/communicate/communicateIconSelected.png"
      }, 
      {
        pagePath: "/pages/dialogue/dialogue",
        text: "对话",
        iconPath: "/icon/dialogue/dialogueIcon.png",
        selectedIconPath: "/icon/dialogue/dialogueIconSelected.png"
      },
      {
        pagePath: "/pages/my/my",
        text: "我的",
        iconPath: "/icon/my/myIcon.png",
        selectedIconPath: "/icon/my/myIconSelected.png"
      }
    ]
  },
 
  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      console.log("切换index>>>"+data.index);
      wx.switchTab({ url })
      this.setData({
        selected: data.index
      })
    }
  }
})
 